home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / TIME_ZON / COAPP.C < prev    next >
Text File  |  1991-11-08  |  2KB  |  162 lines

  1. /*****
  2.  * COApp.c
  3.  *
  4.  *    Application methods for a typical application.
  5.  *
  6.  *  Copyright ⌐ 1990 Symantec Corporation.  All rights reserved.
  7.  *
  8.  *****/
  9.  
  10. #include "COApp.h"
  11. #include "CODoc.h"
  12. #include <Quickdraw.h>
  13.  
  14. extern    OSType    gSignature;
  15.  
  16. #define        kExtraMasters        4
  17. #define        kRainyDayFund        20480
  18. #define        kCriticalBalance    20480
  19. #define        kToolboxBalance        20480
  20.  
  21.  
  22. /***
  23.  * IOApp
  24.  *
  25.  ***/
  26.  
  27. void COApp::IOApp(void)
  28.  
  29. {
  30.     CApplication::IApplication( kExtraMasters, kRainyDayFund, 
  31.                         kCriticalBalance, kToolboxBalance);
  32. }
  33.  
  34.  
  35.  
  36. /***
  37.  * SetUpFileParameters
  38.  *
  39.  ***/
  40.  
  41. void COApp::SetUpFileParameters(void)
  42.  
  43. {
  44.     inherited::SetUpFileParameters();    /* Be sure to call the default method */
  45.  
  46.     sfNumTypes = 1;
  47.     sfFileTypes[0] = 'TEXT';
  48.  
  49.     gSignature = 'ccTZ';
  50. }
  51.  
  52.  
  53. /***
  54.  * SetUpMenus 
  55.  *
  56. ***/
  57.  
  58.  void COApp::SetUpMenus()
  59.  {
  60.  
  61.   inherited::SetUpMenus();  /*  Superclass takes care of adding     
  62.                                 menus specified in a MBAR id = 1    
  63.                                 resource    
  64.                             */                          
  65.  }
  66.  
  67.  
  68.  
  69. /***
  70.  * DoCommand
  71.  *
  72.  ***/
  73. void COApp::DoCommand(long theCommand)
  74.  
  75. {
  76.     switch (theCommand) {
  77.     
  78.         case cmdAbout:
  79.             ShowAbout();
  80.             break;
  81.     
  82.         default:    inherited::DoCommand(theCommand);
  83.                     break;
  84.     }
  85. }
  86.  
  87.  
  88. /***
  89.  *
  90.  * UpdateMenus 
  91.  *
  92. ***/
  93.  
  94.  void COApp::UpdateMenus()
  95.  {
  96.   inherited::UpdateMenus();     /* Enable standard commands */      
  97.  }
  98.  
  99.  
  100. /***
  101.  * Exit
  102.  *
  103.  ***/
  104.  
  105. void COApp::Exit()
  106.  
  107. {
  108. }
  109.  
  110.  
  111. /***
  112.  * CreateDocument
  113.  *
  114.  ***/
  115.  
  116. void COApp::CreateDocument()
  117.  
  118. {
  119.     CODoc    *theDocument = NULL;
  120.     
  121.     TRY
  122.     {
  123.         theDocument = new(CODoc);
  124.             
  125.         theDocument->IODoc(this, FALSE);
  126.     
  127.     }
  128.     
  129.     CATCH
  130.     {
  131.          
  132.          if (theDocument) theDocument->Dispose();
  133.  
  134.     }
  135.     ENDTRY;
  136. }
  137.  
  138.  
  139. void
  140. COApp::ShowAbout()
  141. {
  142.     DialogPtr theDlg;
  143.     int which;
  144.     GrafPtr save;
  145.     
  146.     theDlg = GetNewDialog(129,NULL,(WindowPtr) -1);
  147.  
  148.     GetPort(&save);
  149.     SelectWindow(theDlg);
  150.     ShowWindow(theDlg);
  151.     SetPort(theDlg);
  152.  
  153.     ModalDialog(NULL,&which);
  154.     
  155.     DisposDialog(theDlg);
  156.     
  157.     SetPort(save);
  158.  
  159. }
  160.  
  161.  
  162.